package com.rz.htk.warehouse.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.rz.core.common.model.PageEntity;
import com.rz.htk.type.WarehouseStatus;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @ClassName Warehouse
 * @Description 出入库记录
 * @Author maweiyue
 * @Date 2019/4/10 10:37
 */
@TableName("ord_warehouse")
public class Warehouse extends PageEntity {

    @TableId(type = IdType.AUTO)
    private Integer id;

    /** 订单编号 */
    private String commodityCode;

    /** 当前状态：已入库、已出库 */
    private String status;

    /** 入库时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT-8")
    private LocalDateTime inTime;

    /** 入库操作人员 */
    private Integer crteMngId;

    /** 出库时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT-8")
    private LocalDateTime outTime;

    /** 出库操作人员 */
    private Integer updtMngId;

    /** 出库重量 */
    private double weight;

    /** 备注 */
    private String remark;

    /** 订单仓储状态 */
    @TableField(exist = false)
    private WarehouseStatus warehouseStatus;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCommodityCode() {
        return commodityCode;
    }

    public void setCommodityCode(String commodityCode) {
        this.commodityCode = commodityCode;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public LocalDateTime getInTime() {
        return inTime;
    }

    public void setInTime(LocalDateTime inTime) {
        this.inTime = inTime;
    }

    public Integer getCrteMngId() {
        return crteMngId;
    }

    public void setCrteMngId(Integer crteMngId) {
        this.crteMngId = crteMngId;
    }

    public LocalDateTime getOutTime() {
        return outTime;
    }

    public void setOutTime(LocalDateTime outTime) {
        this.outTime = outTime;
    }

    public Integer getUpdtMngId() {
        return updtMngId;
    }

    public void setUpdtMngId(Integer updtMngId) {
        this.updtMngId = updtMngId;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public WarehouseStatus getWarehouseStatus() {
        WarehouseStatus warehouseStatus = null;
        if (this.status.equals(WarehouseStatus.add.getKey())) {
            warehouseStatus = WarehouseStatus.add;
        } else if (this.status.equals(WarehouseStatus.out.getKey())){
            warehouseStatus = WarehouseStatus.out;
        }

        return warehouseStatus;
    }

    public void setWarehouseStatus(WarehouseStatus warehouseStatus) {
        this.warehouseStatus = warehouseStatus;
    }
}
